#!/bin/bash

curl  http://lnmpp.googlecode.com/svn/trunk/bin/envinit | sh

#uninstall useless package
rpm -qa|grep  httpd
rpm -e httpd
rpm -qa|grep mysql
rpm -e mysql
rpm -qa|grep php
rpm -e php

yum -y remove httpd
yum -y remove php
yum -y remove mysql-server mysql
yum -y remove php-mysql

yum -y install yum-fastestmirror
yum -y remove httpd
yum -y update

#install base
for packages in patch make gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal nano fonts-chinese gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip;
do yum -y install $packages; done
#
cmake
if [ $? -ne 0 ]; then
    rpm -ivh "http://lnmpp.googlecode.com/files/cmake-2.6.4-7.el5."$( uname -m)".rpm"               
fi



#curl  http://lnmpp.googlecode.com/svn/trunk/lib/autossh/autossh-1.4b.sh | sh
#curl  http://lnmpp.googlecode.com/svn/trunk/bin/cls_nfs | sh
curl  http://lnmpp.googlecode.com/svn/trunk/lib/pcre/pcre-8.01.sh | sh
#curl  http://lnmpp.googlecode.com/svn/trunk/lib/nginx/nginx-0.8.41.sh | sh
curl  http://lnmpp.googlecode.com/svn/trunk/lib/nginx/nginx-1.0.5.sh | sh
curl  http://lnmpp.googlecode.com/svn/trunk/lib/mysql/mysql-5.5.14.sh | sh
curl  http://lnmpp.googlecode.com/svn/trunk/lib/libmcrypt/libmcrypt-2.5.8.sh | sh
curl  http://lnmpp.googlecode.com/svn/trunk/lib/mhash/mhash-0.9.9.9.sh | sh
curl  http://lnmpp.googlecode.com/svn/trunk/lib/mcrypt/mcrypt-2.6.8.sh | sh
curl  http://lnmpp.googlecode.com/svn/trunk/lib/libiconv/libiconv-1.13.sh | sh
#curl  http://lnmpp.googlecode.com/svn/trunk/lib/php/php-5.2.13.sh | sh
curl  http://lnmpp.googlecode.com/svn/trunk/lib/php/php-5.3.6.sh | sh
curl  http://lnmpp.googlecode.com/svn/trunk/lib/libevent/libevent-2.0.12.sh  | sh
curl  http://lnmpp.googlecode.com/svn/trunk/lib/memcached/memcached-1.4.6.sh  | sh
curl  http://lnmpp.googlecode.com/svn/trunk/lib/php_memcache/php_memcache-2.2.6.sh | sh
curl  http://lnmpp.googlecode.com/svn/trunk/lib/php_svn/php_svn-1.0.1.sh | sh
curl  http://lnmpp.googlecode.com/svn/trunk/lib/snmp/snmp-5.3.2.sh | sh
curl  http://lnmpp.googlecode.com/svn/trunk/lib/zabbix_agent/zabbix_agent-1.6.4.sh | sh
curl  http://lnmpp.googlecode.com/svn/trunk/lib/proftpd/proftpd-1.3.3d.sh | sh
#curl  http://lnmpp.googlecode.com/svn/trunk/bin/rsync | sh
#curl   http://lnmpp.googlecode.com/svn/trunk/lib/magento/magento-1.5.1.0.sh | sh
#curl http://lnmpp.googlecode.com/svn/trunk/lib/xdd/xdd62c.sh | sh
curl  http://lnmpp.googlecode.com/svn/trunk/lib/php_mongo/php_mongo-1.25.sh | sh
curl http://lnmpp.googlecode.com/svn/trunk/lib/mongodb/mongodb-2.0.0.sh | sh
curl http://lnmpp.googlecode.com/svn/trunk/lib/htop/htop-1.0.sh | sh
curl http://lnmpp.googlecode.com/svn/trunk/lib/mongodb/mongodb-2.0.0.sh | sh
curl http://lnmpp.googlecode.com/svn/trunk/lib/nload/nload-0.7.2.sh | sh
curl http://lnmpp.googlecode.com/svn/trunk/lib/checkinstall/checkinstall-1.6.2.sh | sh
curl http://lnmpp.googlecode.com/svn/trunk/lib/jailkit/jailkit-2.14 | sh
curl http://lnmpp.googlecode.com/svn/trunk/lib/tsar/tsar-2.1.0.sh | sh
curl http://lnmpp.googlecode.com/svn/trunk/lib/google-perftools/google-perftools-1.8.3.sh | sh
curl http://lnmpp.googlecode.com/svn/trunk/lib/libunwind/libunwind-0.99.sh | sh
curl http://lnmpp.googlecode.com/svn/trunk/lib/mysql/mysql-tcmalloc-5.1.59.sh | sh

#curl http://lnmpp.googlecode.com/svn/trunk/lib/zabbix_agent/zabbix_agent-1.6.4.sh | sh=======
curl http://lnmpp.googlecode.com/svn/trunk/lib/apr/apr-1.4.6.sh | sh
curl http://lnmpp.googlecode.com/svn/trunk/lib/apr-util/apr-util-1.4.1.sh | sh
curl http://lnmpp.googlecode.com/svn/trunk/lib/httpd/httpd-2.4.2.sh | sh
curl http://lnmpp.googlecode.com/svn/trunk/lib/httpd/httpd-2.2.22.sh | sh
curl http://lnmpp.googlecode.com/svn/trunk/lib/sqlite/sqlite-src-3071300.sh | sh
curl http://lnmpp.googlecode.com/svn/trunk/lib/subversion/subversion-1.7.5.sh | sh

